package com.jintian.smart.kernel.switching.db;

import com.thoughtworks.xstream.annotations.XStreamAlias;
import com.thoughtworks.xstream.annotations.XStreamAsAttribute;
import com.thoughtworks.xstream.annotations.XStreamContainedType;
import com.thoughtworks.xstream.annotations.XStreamImplicit;
import jakarta.xml.bind.annotation.*;
import lombok.Data;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;

/**
 * 文件采集适配器
 */
@Data
@XStreamAlias("fileAdapter")
@XmlRootElement(name = "fileAdapter")
@XmlAccessorType(XmlAccessType.FIELD)
public class ExtractFileAdapter implements Serializable {
    private static final long serialVersionUID = 1L;
    @XStreamAsAttribute
    @XmlAttribute
    private String dir;
    @XStreamAlias("refTable")
    @XStreamImplicit(itemFieldName = "refTable")
    @XStreamContainedType
    @XmlElement(name = "refTable")
    private List<RefTable> refTables = new ArrayList<>();

    @Data
    @XStreamAlias("refTable")
    @XmlRootElement(name = "refTable")
    @XmlAccessorType(XmlAccessType.FIELD)
    public static class RefTable implements Serializable {
        private static final long serialVersionUID = 1L;
        @XStreamAsAttribute
        @XmlAttribute
        String ref;
        @XStreamAsAttribute
        @XmlAttribute
        String dir;
    }
}
